package com.example.person_web.core.component;

import com.example.person_web.common.WrapperResponse;
import io.jsonwebtoken.ExpiredJwtException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(ExpiredJwtException.class)
    public WrapperResponse handleExpiredJwtException(ExpiredJwtException e) {
        return WrapperResponse.fail("jwt令牌已过期");
    }

    @ExceptionHandler(NullPointerException.class)
    public WrapperResponse handNullPointerException(NullPointerException e) {
        return WrapperResponse.fail(e);
    }
}
